public class sum {
    public int sumand(int num[])
    {
        int maxsum=0;
        for (int i = 0; i < num.length; i++) {
            int sum = 0;
            for (int j = i; j < num.length; j++) {
                sum = sum + num[j];
                if (sum > maxsum) {
                    maxsum = sum;
                }
            }
        }
     return maxsum;
    }
}
